package com.espoir.controller;

import com.alibaba.fastjson.JSON;
import com.espoir.pojo.Coordinate;
import com.espoir.service.impl.ShpServiceImpl;
import com.espoir.shp.read01.ShapeModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/shape")
public class ShapeController {
    @Autowired
    private ShpServiceImpl shpService;

    //@RequestMapping("/find")
    //public String find(@RequestParam("long") String l,@RequestParam("lat") String lat){
    //    System.out.println("l = " + l);
    //    System.out.println("lat = " + lat);
    //    List<ShapeModel> list = shpService.findByCoordinate("point(112 39)");
    //    ShapeModel model = list==null ? null : list.get(0);
    //    String data = model.getGeoStr();
    //    String name = model.getName();
    //    System.out.println("name = " + name);
    //    return name;
    //}

    @RequestMapping("/find")
    public ShapeModel find(Coordinate coordinate){
        return shpService.findByCoordinate(coordinate);
    }
}



